"""
    一次性的帧计时器
"""


class OnlyTimer:
    def __init__(self, max_frame):
        self.max_frame = max_frame
        self._is_end = False
        self.type = 0
        if max_frame <= 0:
            self._is_end = True

    def next_frame(self):
        if not self._is_end:
            self.max_frame -= 1
            if self.max_frame < 1:
                self._is_end = True

    def reset(self):
        self._is_end = False

    @property
    def is_end(self):
        return self._is_end

    def __str__(self):
        return f"OnlyTimer  |is_end: {self._is_end}  now_frame: {self.max_frame}"


